1 /*
2 * File: yaw_damper.c
3 *
4 * Code generated for Simulink model 'yaw_damper'.
5 *
6 * Model version : 1.80
7 * Simulink Coder version : 8.5 (R2013b) 08-Aug-2013
8 * C/C++ source code generated on : Mon Feb 03 08:13:39 2014
9 *
10 * Target selection: ert.tlc
11 * Embedded hardware selection: 32-bit Embedded Processor
12 * Code generation objectives: Unspecified
13 * Validation result: Not run
14 */
15
16 #include "yaw_damper.h"
17 #include "yaw_damper_private.h"
18
19 /* Output and update for referenced model: 'yaw_damper' */
20 void yaw_damper(const real_T *rtu_Phi, const real_T *rtu_R, const real_T
21 *rtu_TAS, const boolean_T *rtu_APEng, real_T *rty_RudCmd,
22 rtB_yaw_damper *localB, real_T rtp_rateGain)
23 {
24 real_T u;
25 real_T y;
26
27 /* Outputs for Atomic SubSystem: '<Root>/Basic Yaw Damper' */
28 /* MinMax: '<S1>/MinMax' incorporates:
29 * Constant: '<S1>/Constant'
30 */
31 if ((*rtu_TAS) >= 100.0) {
32 y = *rtu_TAS;
33 } else {
34 y = 100.0;
35 }
36
37 /* Sum: '<S1>/Sum1' incorporates:
38 * Gain: '<S1>/gravity'
39 * MinMax: '<S1>/MinMax'
40 * Product: '<S1>/Product'
41 * Trigonometry: '<S1>/sin'
42 */
43 localB->yawRate = ((32.2 * sin(*rtu_Phi)) / y) - (*rtu_R);
44
45 /* End of Outputs for SubSystem: '<Root>/Basic Yaw Damper' */
46
47 /* Switch: '<Root>/Eng switch' incorporates:
48 * Constant: '<Root>/Constant'
49 */
50 if (*rtu_APEng) {
51 /* Outputs for Atomic SubSystem: '<Root>/Basic Yaw Damper' */
52 /* Gain: '<S1>/Rate Gain' */
53 u = rtp_rateGain * localB->yawRate;
54
55 /* Saturate: '<S1>/Rud Limit' */
56 if (u >= 25.0) {
57 *rty_RudCmd = 25.0;
58 } else if (u <= (-25.0)) {
59 *rty_RudCmd = (-25.0);
60 } else {
61 *rty_RudCmd = u;
62 }
63
64 /* End of Saturate: '<S1>/Rud Limit' */
65 /* End of Outputs for SubSystem: '<Root>/Basic Yaw Damper' */
66 } else {
67 *rty_RudCmd = 0.0;
68 }
69
70 /* End of Switch: '<Root>/Eng switch' */
71 }
72
73 /* Model initialize function */
74 void yaw_damper_initialize(rtB_yaw_damper *localB)
75 {
76 /* Registration code */
77
78 /* block I/O */
79 (void) memset(((void *) localB), 0,
80 sizeof(rtB_yaw_damper));
81 }
82
83 /*
84 * File trailer for generated code.
85 *
86 * [EOF]
87 */
88
|